//
//  UserEditApi.m
//  gamebox_qpp
//
//  Created by 赵隆杰 on 2022/1/6.
//

#import "UserEditApi.h"

@implementation UserEditApi{
    NSString *_feedback;
    NSString *_nickname;
    NSString *_password;
    NSString *_userpic;
    NSString *_username;
}

- (instancetype)initWithFeedback:(NSString *)feedback username:(NSString *)username nickname:(NSString *)nickname password:(NSString *)password userpic:(NSString *)userpic
{
    if (self = [super init])
    {
        _feedback = feedback;
        _nickname = nickname;
        _password = password;
        _userpic = userpic;
        _username = username;
    }
    
    return self;
}

- (NSString *)requestUrl {
    
    return @"user/edit";
}

- (YTKRequestMethod)requestMethod {
    return YTKRequestMethodPUT;
}

- (id)requestArgument {
    
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    if (_feedback.length) {
        params[@"feedback"] = _feedback;
    }
    if (_nickname.length) {
        params[@"nickname"] = _nickname;
    }
    if (_password.length) {
        params[@"password"] = _password;
    }
    if (_userpic.length) {
        params[@"userPic"] = _userpic;
    }
    NSString *token = [LocalData getToken];
    if (token.length) {
        params[@"token"] = token;
    }
    if (_username.length) {
        params[@"username"] = _username;
    }
    return params;
}

@end
